<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 400px;
            height: 200px;
            background: #fef4eb;
            border: 1px solid #f60;
            margin: 0 auto;
        }

        .box1 {
            display: none;
            width: 330px;
            height: 100px;
            border-color: rgb(0, 132, 255);
            background-color: rgb(239, 248, 255);
            margin: 0 auto;
        }

        button {
            color: white;
            background-color: orange;
            font: 12px/1.5 Arial;
            font-weight: 700;
            border: none;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div class="box">
        <button>Get Style</button>
        <button>Set Style</button>
        <button>Default Style</button>
    </div>
    <div class="box1">
        <button>Get Style</button>
        <button>Set Style</button>
        <button>Default Style</button>
    </div>
</body>

</html>
<script>
    var box = document.querySelector('.box')
    var box1 = document.querySelector('.box1')
    var q = window.getComputedStyle(box);
    // console.log(q.backgroundColor);
    var btn = document.querySelectorAll('button')
    btn[0].onclick = function () {
        alert("width: " + q.width + "\n" +
            "height: " + q.height + "\n" +
            "background-color: " + q.backgroundColor)
    }
    btn[1].onclick = function () {
        box.style.display = 'none'
        box1.style.display = 'block'
    }
    btn[2].onclick = function () {
        console.log(1);
        box.style.display = 'block'
        box1.style.display = 'none'
    }
</script>